package com.chainyoung.component_tmtrade.ui.mvp.presenter;


import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.di.scope.FragmentScope;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmtrade.bean.CurrencyMarketList;
import com.chainyoung.component_tmtrade.bean.RegionList;
import com.chainyoung.component_tmtrade.ui.mvp.contract.TradeCurrencyCoupleListContract;
import com.chainyoung.component_tmtrade.ui.mvp.contract.TradeCurrencyTypeListContract;

import java.util.TreeMap;

import javax.inject.Inject;

@FragmentScope
public class TradeCurrencyCoupleListPresenter extends BasePresenter<TradeCurrencyCoupleListContract.Model, TradeCurrencyCoupleListContract.View> {

    @Inject
    public TradeCurrencyCoupleListPresenter(TradeCurrencyCoupleListContract.Model model, TradeCurrencyCoupleListContract.View view) {
        super(model, view);
    }


    public void getMarketCurrencys(TreeMap<String, Object> map) {
        addSubscribe(
                mModel.getCurrencyMarketList(map)
                        .compose(RxUtils.<CurrencyMarketList>rxSchedulerHelper())
                        .subscribeWith(new CommonSubscriber<CurrencyMarketList>(mView) {
                            @Override
                            public void onNext(CurrencyMarketList data) {
                                mView.showMarketCurrencyCouples(data);
                            }
                        })
        );
    }

}
